﻿using Direct.IDAL.Manager.Admin;
using DirectSell.Common.Filter;
using DirectSell.Common.Session;
using Microsoft.Practices.Unity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace DirectSell.WebLayer.Areas.Manager.Controllers
{
    /// <summary>
    /// 初始化数据
    /// </summary>
    public class DelMsgController : Controller
    {
        [Dependency]
        protected IDelMsgRepository _del { get; set; }

        #region 首页
        /// <summary>
        /// 首页
        /// </summary>
        /// <returns></returns>
        [ManagerFilter(IsCheck =true)]
        public ActionResult Index()
        {
            return View();
        }
        #endregion

        #region 清空操作
        /// <summary>
        /// 清空操作
        /// </summary>
        /// <returns></returns>
        public JsonResult DelMsg(string password)
        {
            var info = _del.QueryManagerInfo(SessionInfo.GetManagerSession().ManagerCode);

            if (password != info.ManagerPassWord)
            {
                return Json("密码输入不正确!");
            }
            _del.ExeDelMsg();
            return Json("初始化成功");
        }
        #endregion
    }
}